<?php

use yii\widgets\ActiveForm;
use common\helpers\Url;
use common\enums\StatusEnum;
use common\enums\GenderEnum;
use yii\helpers\ArrayHelper;

$form = ActiveForm::begin([
    'id' => $model->formName(),
    'enableAjaxValidation' => true,
    'class' => 'form-horizontal',
    'validationUrl' => Url::to(['ajax-edit', 'id' => $model['id']]),
    'fieldConfig' => [
        'template' => "<div class='col-sm-3 text-right'>{label}</div><div class='col-sm-9'>{input}\n{hint}\n{error}</div>",
    ]
]);
?>

    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true" onclick="history.go(-1)">×</span></button>
            <h4 class="modal-title">基本信息</h4>
        </div>
        <div class="modal-body">
            <?= $form->field($model, 'books_cate_id')->dropDownList(ArrayHelper::map($BooksCate,'id','title'));?>
            <?= $form->field($model, 'image')->widget('common\widgets\webuploader\Files', [
                'type' => 'files',
                'config' => [ // 配置同图片上传
                    // 'server' => \yii\helpers\Url::to(['file/files']), // 默认files 支持videos/voices/images方法验证
                    'pick' => [
                        'multiple' => false,
                    ]
                ]
            ]);?>
            <?= $form->field($model, 'name')->textInput() ?>
            <?= $form->field($model, 'desc')->textarea() ?>
            <?= $form->field($model, 'file')->widget('common\widgets\webuploader\Files', [
                'type' => 'files',
                'config' => [ // 配置同图片上传
                    // 'server' => \yii\helpers\Url::to(['file/files']), // 默认files 支持videos/voices/images方法验证
                    'pick' => [
                        'multiple' => false,
                    ]
                ]
            ]);?>
            <?= $form->field($model, 'author')->textInput() ?>
            <?= $form->field($model, 'heat_degree')->textInput() ?>
            <?= $form->field($model, 'read_num')->textInput() ?>
            <?= $form->field($model, 'words')->textInput() ?>
            <?= $form->field($model, 'collect')->textInput() ?>
            <?= $form->field($model, 'advert')->textInput() ?>
            <?= $form->field($model, 'book_status')->radioList(GenderEnum::getBookStatus()) ?>
            <?= $form->field($model, 'sort')->textInput() ?>
            <?= $form->field($model, 'status')->radioList(StatusEnum::getMap()) ?>
        </div>
        <div class="modal-footer">
            <span class="btn btn-white" onclick="history.go(-1)">返回</span>
            <button class="btn btn-primary" type="submit">保存</button>
        </div>
    </div>

<?php ActiveForm::end(); ?>